package com.hup.winHolderService.controller;

import com.hup.winHolderService.model.LoginReq;
import com.hup.winHolderService.security.SecurityService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hugan
 * @date 2023/10/4
 */
@RestController
@RequestMapping("/sys")
@RequiredArgsConstructor
public class SysController {

    private final SecurityService securityService;

    @PostMapping("/login")
    public ResponseEntity<String> login(@Validated @RequestBody LoginReq req) {
        return ResponseEntity.ok(securityService.login(req));
    }

    @GetMapping("/loginTip")
    public ResponseEntity<String> loginTip() {
        return ResponseEntity.ok(securityService.loginTip());
    }

}
